Skip to content

Prevent guessed types from being anything but namespaces#4102

Merged
vinistock merged 2 commits intorubydex_adoption_feature_branchfrom
vs_prevent_guessing_non_namespace_types
May 8, 2026
Merged

Prevent guessed types from being anything but namespaces#4102
vinistock merged 2 commits intorubydex_adoption_feature_branchfrom
vs_prevent_guessing_non_namespace_types

Conversation

@vinistock
Copy link
Copy Markdown
Member

Motivation

A small bug I noticed when playing around with the fully migrated LSP: a guessed type might accidentally match a constant that's not a module or class (by nature of how the guessing works). We never want to return a constant though because that's not a valid type and that ends up crashing completion.

Implementation

The check should not just verify for nil, but rather confirm the returned type of the declaration.

Automated Tests

Added a couple of tests that fail before.

@vinistock vinistock requested review from Morriar, alexcrocha and st0012 May 8, 2026 17:50
@vinistock vinistock self-assigned this May 8, 2026
@vinistock vinistock requested a review from a team as a code owner May 8, 2026 17:50
@vinistock vinistock added bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes labels May 8, 2026
Base automatically changed from vs_remove_old_indexer to rubydex_adoption_feature_branch May 8, 2026 18:33
@vinistock vinistock merged commit 03d0d1f into rubydex_adoption_feature_branch May 8, 2026
36 checks passed
@vinistock vinistock deleted the vs_prevent_guessing_non_namespace_types branch May 8, 2026 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix This PR will fix an existing bug server This pull request should be included in the server gem's release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants